module.exports = {
	root: true,
	env: { browser: true, es2020: true },
	extends: [
		"eslint:recommended",
		"plugin:@typescript-eslint/recommended",
		"plugin:react-hooks/recommended",
		"plugin:import/errors",
		"plugin:import/typescript",
		"plugin:prettier/recommended",
	],
	ignorePatterns: ["dist", ".eslintrc.cjs"],
	parser: "@typescript-eslint/parser",
	plugins: [
		"react-refresh",
		"@typescript-eslint",
		"react-hooks",
		"unused-imports",
		"react",
		"@typescript-eslint",
		"editorconfig",
	],
	rules: {
		"editorconfig/charset": "error",
		"editorconfig/eol-last": "error",
		"editorconfig/indent": "error",
		"editorconfig/linebreak-style": "error",
		"editorconfig/no-trailing-spaces": "error",
		"no-unused-vars": "off",
		"react/require-default-props": 0,
		"unused-imports/no-unused-imports": "error",
		"@typescript-eslint/explicit-module-boundary-types": 0,
		"react/jsx-filename-extension": [1, { extensions: [".tsx"] }],
		"react/jsx-props-no-spreading": 0,
		"jsx-a11y/anchor-is-valid": 0,
		"react/react-in-jsx-scope": 0,
		"react/display-name": 0,
		"react/prop-types": 0,
		"@typescript-eslint/explicit-function-return-type": 0,
		"@typescript-eslint/explicit-member-accessibility": 0,
		"@typescript-eslint/indent": 0,
		"@typescript-eslint/member-delimiter-style": 0,
		"@typescript-eslint/no-explicit-any": 0,
		"@typescript-eslint/no-var-requires": 0,
		"no-use-before-define": 0,
		"import/no-unresolved": "off",
		"no-useless-catch": "off",
		"@typescript-eslint/no-use-before-define": 0,
		"import/extensions": "off",
		"react/no-unescaped-entities": 0,
		"jsx-a11y/label-has-associated-control": 0,
		"react/no-unused-prop-types": 0,
		"no-underscore-dangle": 0,
		"@typescript-eslint/no-unused-vars": [
			0,
			{
				argsIgnorePattern: "^_",
			},
		],
		"no-console": [
			2,
			{
				allow: ["warn", "error"],
			},
		],
		"import/order": [
			"error",
			{
				groups: [
					"external",
					"builtin",
					"internal",
					"sibling",
					"parent",
					"type",
					"index",
				],
				pathGroups: [
					{
						pattern: "react",
						group: "external",
						position: "before",
					},
					{
						pattern: "app/**",
						group: "internal",
						position: "after",
					},
					{
						pattern: "pages/**",
						group: "internal",
						position: "after",
					},
					{
						pattern: "widgets/**",
						group: "internal",
						position: "after",
					},
					{
						pattern: "features/**",
						group: "internal",
						position: "after",
					},
					{
						pattern: "entities/**",
						group: "internal",
						position: "after",
					},
					{
						pattern: "shared/**",
						group: "internal",
						position: "after",
					},
					{
						pattern: "./index.types",
						group: "index",
						position: "after",
					},
					{
						pattern: "./index.styled",
						group: "index",
						position: "after",
					},
				],
				pathGroupsExcludedImportTypes: [
					"app/**",
					"pages/**",
					"widgets/**",
					"features/**",
					"entities/**",
					"shared/**",
					"./index.types",
					"./index.styled",
				],
				"newlines-between": "always",
				alphabetize: {
					order: "asc",
					caseInsensitive: true,
				},
			},
		],
	},
};
